package com.instwall.callnum;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.instwall.callbase.MConfig;
import com.instwall.callbase.tool.LogUtil;
import com.instwall.callnum.basecomponent.CallNumBaseComponent;
import com.instwall.callnumserver.service.CallNumService;
import com.instwall.callnumzigbee.broadcast.MyReceiver;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        getNatvieSupport();
        getBuildConfigProperty();
        startCallNumService();
    }

    private void initView() {
        TextView get_Version = findViewById(R.id.get_Version);
        get_Version.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MyReceiver.listener.MessageReceiver("dsd");
            }
        });
    }

    private void getNatvieSupport() {
        LogUtil.LogV(MConfig.TAG, MConfig.getEvn() == Boolean.TRUE ? "Native CheckModel OK" : "Native CheckModel Error");
    }

    private void getBuildConfigProperty() {
        String MODE = (String) CallNumBaseComponent.getBuildConfigFieldValue("MODE");
        int NUM = (int) CallNumBaseComponent.getBuildConfigFieldValue("NUM");
        LogUtil.LogI(MConfig.TAG, "[MainActivity][getBuildConfigProperty()][MODE VALUE]" + MODE);
        LogUtil.LogI(MConfig.TAG, "[MainActivity][getBuildConfigProperty()][NUM]" + NUM);
    }

    /**
     * Start Service From Activity
     */
    private void startCallNumService() {
        Intent intent = new Intent(this, CallNumService.class);
        startService(intent);
    }
}
